home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dodge.swf / scripts / __Packages / HudManager.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.2 KB  |  46 lines

  1. class HudManager extends MovieClip implements Steppable
  2. {
  3.    var hud;
  4.    var lastMultiplier;
  5.    var lastScore;
  6.    function HudManager()
  7.    {
  8.       super();
  9.       this.hud = _root.attachMovie("hud","hud",-8);
  10.       Stepper.add(this);
  11.    }
  12.    function step()
  13.    {
  14.       this.updateHealth();
  15.       this.updateMultiplier();
  16.       this.updateScore();
  17.    }
  18.    function updateHealth()
  19.    {
  20.       this.hud.health = _root.player.getHealth();
  21.    }
  22.    function updateMultiplier()
  23.    {
  24.       if(ScoreManager.getMultiplier() != this.lastMultiplier)
  25.       {
  26.          this.hud.multiplier = ScoreManager.getMultiplier() + "x";
  27.          var _loc2_ = new Array();
  28.          _loc2_.push(new flash.filters.GlowFilter(16777215,25,7,7,ScoreManager.getMultiplier() / 4 - 0.25,2));
  29.          this.hud.multBox.filters = _loc2_;
  30.          this.lastMultiplier = ScoreManager.getMultiplier();
  31.       }
  32.    }
  33.    function updateScore()
  34.    {
  35.       if(ScoreManager.getScore() != this.lastScore)
  36.       {
  37.          this.hud.score = ScoreManager.getScore();
  38.          this.lastScore = ScoreManager.getScore();
  39.       }
  40.    }
  41.    function die()
  42.    {
  43.       Stepper.remove(this);
  44.    }
  45. }
  46.